﻿using System;

namespace Transformable_Engine_v2.Engine.Helper
{
    public static class Randomizer
    {
        private static Random _rnd = new Random();

        public static int Int()
        {
            return _rnd.Next();
        }

        public static int Int(int maxValue)
        {
            return _rnd.Next(maxValue + 1);
        }

        public static int Int(int minValue, int maxValue)
        {
            return _rnd.Next(minValue, maxValue + 1);
        }

        public static bool Probability(float percentage)
        {
            return _rnd.NextDouble() < percentage;
        }

        public static double Double()
        {
            return _rnd.NextDouble();
        }
        public static double Double(double maxValue)
        {
            return _rnd.NextDouble() * maxValue;
        }

        public static double Double(double minValue, double maxValue)
        {
            var value = minValue + _rnd.NextDouble()*(maxValue - minValue);
            return value;
        }

        public static float Float(float minValue, float maxValue)
        {
            return (float) Double(minValue, maxValue);
        }

        public static float Float(int maxValue)
        {
            return (float)Double(maxValue);
        }
    }
}